import { GLOBAL } from '../../../config/global';
import navigationSeevice from '../../../components/navigation/navigationSeevice';

class OrderNewOilCreactService {
	jump(page, params, cb) {
		this.props.navigation.navigate(page, {
			...params,
			callBack: cb,
		});
	}

	reset(tCode) {
		let params = {
			isZXY: true,
			typeIndex: 2
		};
		tCode === 'SINONEWC' ? params.statusIndex = 2 : tCode === 'SINONEWP' ? params.statusIndex = 0 : params.statusIndex = 1;
		let nameStr = 'HomePage';
		if (GLOBAL.ORDER_KEY == 'CustomerStack') {
			nameStr = 'CrMtManage';
			navigationSeevice.reset('OrderListPage', params, [{ routeName: nameStr }]);
		} else if (GLOBAL.ORDER_KEY == 'OrderStack') {
			nameStr = 'OrderListPage';
			navigationSeevice.reset('OrderListPage', params);
		} else if (GLOBAL.ORDER_KEY == 'ReportStack') {
			nameStr = 'ReportIndexPage';
			navigationSeevice.reset('OrderListPage', params, [{ routeName: nameStr }]);
		} else {
			navigationSeevice.reset('OrderListPage', params, [{ routeName: nameStr }]);
		}
	}

}

module.exports = new OrderNewOilCreactService();